package com.heyu.springmvc.controller;



import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class FirstController implements Controller {

	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
		ModelAndView mav = new ModelAndView();
		// 添加模型数据，可以是任何的POJO对象
		mav.addObject("msg", "这是我的第一个Spring MVC程序");
		// 设置逻辑视图名，视图解析器会根据该名字解析到具体的视图页面
		mav.setViewName("/WEB-INF/jsp/first.jsp");
		// 返回ModelAndView 对象
		return mav;
	}
}

